package com.ryl.yomall.weball.controller;

import com.ryl.yomall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @Date 14:13
 * @Author ryl
 */
@Controller
public class ItemController {
    @Autowired
    private ItemFeignClient itemFeignClient;
    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable Long skuId,Model model){
        Map item = itemFeignClient.getItem ( skuId );
        model.addAllAttributes ( item );
        return "item/index";
    }
}
